|
|
|
|
|
|
|
Listing 10.10. Coding the RSInit function. |
|
|
|
|
|
|
|
|
Public Function RSInit(frmTemp As Object)
'
' clear all input controls on the form
'
On Error GoTo LocalErr
'
Dim ctlTemp As Control
Dim strTag As String
'
For Each ctlTemp In frmTemp.Controls
strTag = UCase(Trim(ctlTemp.Tag))
If strTag <> "" Then
ctlTemp = ""
End If
Next
'
RSInit = 0
Exit Function
'
LocalErr:
RSInit = Err.Number
'
End Function |
|
|
|
|
|
|
|
|
This routine contains a simple loop that checks all the controls on the form to see whether they are bound to a dataset column. If they are, the control is initialized. |
|
|
|
|
|
|
|
|
The RSLocate routine prompts the user to enter a value to use as a search criteria on the Recordset. The routine is smart enough to use the Seek method for table objects and the Find method for non-table objects. Add the routine in Listing 10.11 to your module. |
|
|
|
|
|
|
|
|
Listing 10.11. Coding the RSLocate routine. |
|
|
|
|
|
|
|
|
Public Function RSLocate(FieldName As String)
'
' search the designated field
'
On Error GoTo LocalErr
'
Dim strSearch As String
'
If blnIndex = True Then
rs.Index = strIndex |
|
|
|
|
|